/**
*      author: Y_Yao
*      created: 2025-01-24 13:40:17
**/

#include<bits/stdc++.h>

#define int LL
using namespace std;
using LL = long long;
const LL LLINF = 1e18;
const int INF = 0x3f3f3f3f;
const int N = 2e5 + 7;
int a[N];
int n,x,y;

void solve()
{
    cin >> n >> x >> y;
    int sum = 0;
    for(int i = 1;i <= n;i++)
    {
        cin >> a[i];
        sum += a[i];
    }
    sort(a + 1, a + 1 + n);
    int ans = 0;
    int l = sum - y,r = sum - x;
    for(int i = 1; i <= n;i++)
    {
        int re = l - a[i];
        auto it1 = lower_bound(a+i+1,a+n+1,re) - a;
        //cout << it1 << endl;;
        re = r - a[i];
        auto it2 = upper_bound(a+i+1,a+1+n,re) - a - 1;
        //cout << it2 << endl;

        ans += it2 - it1 + 1;
    }
    cout << ans << endl;
}

signed main()
{
    ios::sync_with_stdio(false);
    cin.tie(0);

    int t = 1;
    cin >> t;
    while(t--)
    {
        solve();
    }
    return 0;
}